package com.example.apiproject.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.io.Serializable;

/**
 * (Messages)实体类
 *
 * @author makejava
 * @since 2023-09-23 13:40:57
 */
@Data
public class Messages implements Serializable {
    private static final long serialVersionUID = -47695181042575558L;

/**
     * 唯一标识一条消息
     */
    private Integer id;
/**
     * 发送者ID
     */
    private Integer fromId;

    private String fromAvatar;

    private String fromUsername;
/**
     * 接收方ID（用户、群）
     */
    private Integer toId;

    private String toAvatar;

    private String toUsername;

    private Integer isRead;
    private String from_articleId;
    public  String getFromArticleId(){return  from_articleId;}
    public  void  setFromArticleId(String from_articleId){this.from_articleId=from_articleId;}
    public String getFromUsername() {
        return fromUsername;
    }

    public void setFromUsername(String fromUsername) {
        this.fromUsername = fromUsername;
    }

    public String getToUsername() {
        return toUsername;
    }

    public void setToUsername(String toUsername) {
        this.toUsername = toUsername;
    }

    public Integer getIsRead() {
        return isRead;
    }

    public void setIsRead(Integer isRead) {
        this.isRead = isRead;
    }
    /**
     * 发送时间
     */
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
/**
     * 0:已接收、1:未接收
     */
    private Integer status;
/**
     * 0:文字、1:图片、2:文件
     */
    private Integer msgType;
/**
     * 0:用户、1:群组
     */
    private Integer type;

    public String getFromAvatar() {
        return fromAvatar;
    }

    public void setFromAvatar(String fromAvatar) {
        this.fromAvatar = fromAvatar;
    }

    public String getToAvatar() {
        return toAvatar;
    }

    public void setToAvatar(String toAvatar) {
        this.toAvatar = toAvatar;
    }

    /**
     * 文字内容、图片/文件地址
     */
    private String content;


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getFromId() {
        return fromId;
    }

    public void setFromId(Integer fromId) {
        this.fromId = fromId;
    }

    public Integer getToId() {
        return toId;
    }

    public void setToId(Integer toId) {
        this.toId = toId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getMsgType() {
        return msgType;
    }

    public void setMsgType(Integer msgType) {
        this.msgType = msgType;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getContent() {
        return content;
    }

    @Override
    public String toString() {
        return "Messages{" +
                "id=" + id +
                ", fromId=" + fromId +
                ", fromAvatar='" + fromAvatar + '\'' +
                ", toId=" + toId +
                ", toAvatar='" + toAvatar + '\'' +
                ", createTime=" + createTime +
                ", status=" + status +
                ", msgType=" + msgType +
                ", type=" + type +
                ", content='" + content + '\'' +
                '}';
    }

    public void setContent(String content) {
        this.content = content;
    }

}

